import { ADD_PERSON } from "../constant";
import { nanoid } from "nanoid";
const initPersons = [{ id: nanoid(), name: "丽萍", age: 18 }];
export default (preState = initPersons, action) => {
  const { type, data } = action;
  switch (type) {
    case ADD_PERSON:
      return [data, ...preState];
    default:
      return preState;
  }
};
